package com.yuluo.aihelper.ai;

import com.yuluo.aihelper.ai.guardrail.SafeInputGuradrail;
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.Result;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.guardrail.InputGuardrails;
import reactor.core.publisher.Flux;

import java.util.List;

@InputGuardrails({SafeInputGuradrail.class})
public interface AiHelperService {

    /**
     * 流式问答
     * @param memoryId 会话记忆ID
     * @param userMessage 用户消息
     * @return AI回答
     */
    @SystemMessage(fromResource = "system-prompt.txt")
    Flux<String> chatStream(@MemoryId int memoryId, @UserMessage String userMessage);
    /**
     * 简单问答
     * @param userMessage 用户消息
     * @return AI回答
     */
    @SystemMessage(fromResource = "system-prompt.txt")
    String chat(String userMessage);

    /**
     * 结构化输出
     * @param userMessage 用户消息
     * @return 结构化输出结果
     */
    @SystemMessage(fromResource = "system-prompt.txt")
    Report chatForReport(String userMessage);

    /**
     * 基于 RAG 的回答
     * @param userMessage 用户消息
     * @return AI回答
     */
    @SystemMessage(fromResource = "system-prompt.txt")
    Result<String> chatWithRag(String userMessage);

    record Report(String name, List<String> suggestionList){}
}
